package demo3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: atp
 * Date: 2022-10-30
 * Time: 16:41
 */
interface IShape {
    void draw();
}
//alt+Enter
class Rect implements IShape {

    @Override
    public void draw() {
        System.out.println("矩形");
    }
}
class Flower implements IShape {

    @Override
    public void draw() {
        System.out.println("花");
    }
}
class Cycle implements IShape {

    @Override
    public void draw() {
        System.out.println("圆");
    }
}

public class Test4 {
    public static void drawMap(IShape iShape) {
        iShape.draw();
    }
    public static void main1(String[] args) {
        Rect rect = new Rect();
        drawMap(rect);
        drawMap(new Cycle());
        drawMap(new Flower());
        //IShape iShape = new Cycle();
    }
}
